package com.eastfair.venueservice.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import java.time.LocalDate;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.eastfair.database.mybatis.typehandler.M9EncryptHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;
import com.eastfair.venueservice.enumeration.ServiceBorrowReturnGoodsLossStateEnum;
import com.eastfair.venueservice.enumeration.ServiceBorrowReturnReturnStateEnum;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 借用归还记录
 * </p>
 *
 * @author dq
 * @since 2022-09-20
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName(value="vsm_service_borrow_return",autoResultMap = true)
@ApiModel(value = "ServiceBorrowReturn", description = "借用归还记录")
@AllArgsConstructor
public class ServiceBorrowReturn extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 是否启用（确认状态）：1是 已确认；0否 未确认
     */
    @ApiModelProperty(value = "是否启用（确认状态）：1是 已确认；0否 未确认")
    @TableField(value = "is_enabled")
    @Excel(name = "是否启用（确认状态）：1是 已确认；0否 未确认")
    private Integer isEnabled;

    /**
     * 是否删除：1是；0否
     */
    @ApiModelProperty(value = "是否删除：1是；0否")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除：1是；0否")
    private Integer isDeleted;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @TableField(value = "project_id")
    @Excel(name = "项目id")
    private Long projectId;

    /**
     * 子系统id
     */
    @ApiModelProperty(value = "子系统id")
    @TableField(value = "subsystem_id")
    @Excel(name = "子系统id")
    private Long subsystemId;

    /**
     * 租户id
     */
    @ApiModelProperty(value = "租户id")
    @TableField(value = "tenant_id")
    @Excel(name = "租户id")
    private Long tenantId;

    /**
     * 库存编码
     */
    @ApiModelProperty(value = "库存编码")
    @Size(max = 255, message = "库存编码长度不能超过255")
    @TableField(value = "inventory_code", condition = LIKE)
    @Excel(name = "库存编码")
    private String inventoryCode;

    /**
     * 借用原因
     */
    @ApiModelProperty(value = "借用原因")
    @Size(max = 255, message = "借用原因长度不能超过255")
    @TableField(value = "borrow_reason", condition = LIKE)
    @Excel(name = "借用原因")
    private String borrowReason;

    /**
     * 借用数量
     */
    @ApiModelProperty(value = "借用数量")
    @TableField(value = "borrow_num")
    @Excel(name = "借用数量")
    private BigDecimal borrowNum;

    /**
     * 借用部门id
     */
    @ApiModelProperty(value = "借用部门id")
    @TableField(value = "borrow_org_id")
    @Excel(name = "借用部门id")
    private Long borrowOrgId;

    /**
     * 借用部门名称
     */
    @ApiModelProperty(value = "借用部门名称")
    @Size(max = 255, message = "借用部门名称长度不能超过255")
    @TableField(value = "borrow_org_name", condition = LIKE)
    @Excel(name = "借用部门名称")
    private String borrowOrgName;

    /**
     * 借用人
     */
    @ApiModelProperty(value = "借用人")
    @Size(max = 255, message = "借用人长度不能超过255")
    @TableField(value = "borrower", condition = LIKE)
    @Excel(name = "借用人")
    private String borrower;

    /**
     * 联系方式
     */
    @ApiModelProperty(value = "联系方式")
    @Size(max = 255, message = "联系方式长度不能超过255")
    @TableField(value = "contact", condition = LIKE)
    @Excel(name = "联系方式")
    private String contact;

    /**
     * 使用地点
     */
    @ApiModelProperty(value = "使用地点")
    @Size(max = 255, message = "使用地点长度不能超过255")
    @TableField(value = "using_address", condition = LIKE)
    @Excel(name = "使用地点")
    private String usingAddress;

    /**
     * 借用日期
     */
    @ApiModelProperty(value = "借用日期")
    @TableField(value = "borrow_date")
    @Excel(name = "借用日期", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDate borrowDate;

    /**
     * 借用经办人
     */
    @ApiModelProperty(value = "借用经办人")
    @TableField(value = "borrow_operator")
    @Excel(name = "借用经办人")
    private Long borrowOperator;

    /**
     * 借用经办人姓名
     */
    @ApiModelProperty(value = "借用经办人姓名")
    @Size(max = 100, message = "借用经办人姓名长度不能超过100")
    @TableField(value = "borrow_operator_name", condition = LIKE)
    @Excel(name = "借用经办人姓名")
    private String borrowOperatorName;

    /**
     * 预计归还日期
     */
    @ApiModelProperty(value = "预计归还日期")
    @TableField(value = "expected_return_date")
    @Excel(name = "预计归还日期", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDate expectedReturnDate;

    /**
     * 实际归还日期
     */
    @ApiModelProperty(value = "实际归还日期")
    @TableField(value = "real_return_date")
    @Excel(name = "实际归还日期", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDate realReturnDate;

    /**
     * 备注
     */
    @ApiModelProperty(value = "备注")
    @Size(max = 255, message = "备注长度不能超过255")
    @TableField(value = "remark", condition = LIKE)
    @Excel(name = "备注")
    private String remark;

    /**
     * 归还人
     */
    @ApiModelProperty(value = "归还人")
    @Size(max = 255, message = "归还人长度不能超过255")
    @TableField(value = "returnee", condition = LIKE)
    @Excel(name = "归还人")
    private String returnee;

    /**
     * 归还人手机号码
     */
    @ApiModelProperty(value = "归还人手机号码")
    @Size(max = 255, message = "归还人手机号码长度不能超过255")
    @TableField(value = "return_phone", condition = LIKE,typeHandler = M9EncryptHandler.class)
    @Excel(name = "归还人手机号码")
    private String returnPhone;

    /**
     * 物资完损状态 #{SEVERE_DAMAGE:严重损坏;PARTIAL_DAMAGE:部分损坏;SLIGHT_DAMAGE:轻微损坏;UNDAMAGED:未损坏}
     */
    @ApiModelProperty(value = "物资完损状态 #{SEVERE_DAMAGE:严重损坏;PARTIAL_DAMAGE:部分损坏;SLIGHT_DAMAGE:轻微损坏;UNDAMAGED:未损坏}")
    @TableField(value = "goods_loss_state")
    @Excel(name = "物资完损状态 #{SEVERE_DAMAGE:严重损坏;PARTIAL_DAMAGE:部分损坏;SLIGHT_DAMAGE:轻微损坏;UNDAMAGED:未损坏}", replace = {"严重损坏_SEVERE_DAMAGE", "部分损坏_PARTIAL_DAMAGE", "轻微损坏_SLIGHT_DAMAGE", "未损坏_UNDAMAGED",  "_null"})
    private ServiceBorrowReturnGoodsLossStateEnum goodsLossState;

    /**
     * 归还备注
     */
    @ApiModelProperty(value = "归还备注")
    @Size(max = 255, message = "归还备注长度不能超过255")
    @TableField(value = "return_remark", condition = LIKE)
    @Excel(name = "归还备注")
    private String returnRemark;

    /**
     * 归还经办人
     */
    @ApiModelProperty(value = "归还经办人")
    @TableField(value = "return_operator")
    @Excel(name = "归还经办人")
    private Long returnOperator;

    /**
     * 归还经办人姓名
     */
    @ApiModelProperty(value = "归还经办人姓名")
    @Size(max = 100, message = "归还经办人姓名长度不能超过100")
    @TableField(value = "return_operator_name", condition = LIKE)
    @Excel(name = "归还经办人姓名")
    private String returnOperatorName;

    /**
     * 归还状态 #{NO:未归还;YES:已归还}
     */
    @ApiModelProperty(value = "归还状态 #{NO:未归还;YES:已归还}")
    @TableField(value = "return_state")
    @Excel(name = "归还状态 #{NO:未归还;YES:已归还}", replace = {"未归还_NO", "已归还_YES",  "_null"})
    private ServiceBorrowReturnReturnStateEnum returnState;


    @Builder
    public ServiceBorrowReturn(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    Integer isEnabled, Integer isDeleted, Long projectId, Long subsystemId, Long tenantId, 
                    String inventoryCode, String borrowReason, BigDecimal borrowNum, Long borrowOrgId, String borrowOrgName, String borrower, 
                    String contact, String usingAddress, LocalDate borrowDate, Long borrowOperator, String borrowOperatorName, LocalDate expectedReturnDate, 
                    LocalDate realReturnDate, String remark, String returnee, String returnPhone, ServiceBorrowReturnGoodsLossStateEnum goodsLossState, String returnRemark, 
                    Long returnOperator, String returnOperatorName, ServiceBorrowReturnReturnStateEnum returnState) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
        this.projectId = projectId;
        this.subsystemId = subsystemId;
        this.tenantId = tenantId;
        this.inventoryCode = inventoryCode;
        this.borrowReason = borrowReason;
        this.borrowNum = borrowNum;
        this.borrowOrgId = borrowOrgId;
        this.borrowOrgName = borrowOrgName;
        this.borrower = borrower;
        this.contact = contact;
        this.usingAddress = usingAddress;
        this.borrowDate = borrowDate;
        this.borrowOperator = borrowOperator;
        this.borrowOperatorName = borrowOperatorName;
        this.expectedReturnDate = expectedReturnDate;
        this.realReturnDate = realReturnDate;
        this.remark = remark;
        this.returnee = returnee;
        this.returnPhone = returnPhone;
        this.goodsLossState = goodsLossState;
        this.returnRemark = returnRemark;
        this.returnOperator = returnOperator;
        this.returnOperatorName = returnOperatorName;
        this.returnState = returnState;
    }

}
